package de.wtschreiter.structured.document.io.event;

import static org.junit.Assert.assertEquals;

import java.util.Arrays;
import java.util.Collection;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;

@RunWith(value = Parameterized.class)
public class EventTypeValueOfTest {

    private final String eventTypeName;

    public EventTypeValueOfTest(final String eventTypeName) {
        this.eventTypeName = eventTypeName;
    }

    @Parameters
    public static Collection<Object[]> data() {
        EventType[] eventTypeValues = EventType.values();
        Object[][] data = new Object[eventTypeValues.length][1];
        for (int i = 0; i < eventTypeValues.length; i++) {
            data[i][0] = eventTypeValues[i].toString();
        }
        return Arrays.asList(data);
    }

    @Test
    public void findEventTypeForString() throws Exception {
        assertEquals(eventTypeName, EventType.valueOf(eventTypeName).toString());
    }

}
